function checkAuthentication(type) {
    const currentDealer = JSON.parse(localStorage.getItem('currentDealer')) || {}
    if (!currentDealer || !currentDealer.token || currentDealer.token === '') {
        alert('您还未登录，请先登录！');
        switch (type) {
            case 0:
                window.location.href = 'pages/login.html';
                break;
            case 1:
                window.location.href = 'login.html';
                break;
            case 2:
                window.location.href = '../login.html';
                break;
        }
    }
}

function exit(type) {
    localStorage.removeItem('currentDealer');
    localStorage.removeItem('dealerMenuList');
    switch (type) {
        case 0:
            window.location.href = 'pages/login.html';
            break;
        case 1:
            window.location.href = 'login.html';
            break;
        case 2:
            window.location.href = '../login.html';
            break;
    }
}